package cn.com.fstar.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.fstar.framework.base.controller.BaseController;
import cn.com.fstar.framework.base.model.JsonResult;
import cn.com.fstar.demo.service.TaskDemoService;

/**
 * 该模块主要为了展示图表例子，方便其他程序员学习使用
 * 
 * @author
 *
 */

@Controller
@RequestMapping("/taskdemos")
public class TaskDemoController extends BaseController {

	@Autowired
	private TaskDemoService taskDemoService;

	/***
	 * 跳转到图表页面
	 * 
	 * @return
	 */
	@RequestMapping("/getUserInfo")
	@ResponseBody
	public JsonResult getUserInfo() {

		JsonResult json = new JsonResult();

		json.setObj(taskDemoService.getUserCount());
		json.setSuccess(true);
		return json;

	}

	@RequestMapping("/showdemo")
	public String showDemo() {
		return "/demo/task/showdemo";
	}

	/***
	 * 定时任务用于更新 service层中的用户属性信息
	 */
	public void taskJob() {
		taskDemoService.getUserCount();
	}

}
